<?php
namespace Tbf\Bundle\UpyunBundle\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Tbf\Bundle\TbfBundle\Command\TbfCommand;
use Tbf\Bundle\UpyunBundle\Model\Upyun;
class DeleteCommand extends TbfCommand
{
    protected function configure()
    {
        $this
            ->setName('upyun:delete')
            ->setDescription('delete file from upyun')
            ->setDefinition(array(
                new InputArgument('upyun_path',InputArgument::REQUIRED,'path of upyun'),
            ))
            ->setHelp(<<<EOT
Delete file from upyun.
EOT
            );
    }
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $upyun_path = $input->getArgument('upyun_path');
        $upyun = $this->get('tbf_upyun');
        $cmd = $upyun->newUpyunCmd();
        $cmd->addDeleteCmd($upyun_path);
        $upyun->runCommandWithGolang($cmd);
    }
}
